package com.johanChan.utils;

import java.util.ArrayList;
import java.util.List;

public class Tree<T> {
    /**
     * 节点ID
     */
    private Integer id;
    /**
     * 显示节点文本
     */
    private String text;
    /**
     * 父ID
     */
    private Integer parentId;

    private Integer level;
    /**
     * 节点的子节点
     */
   // private List<Tree<T>> nodes = new ArrayList<Tree<T>>();
    private List<Tree<T>> nodes = null;

    public Tree() {}
    public Tree(Integer id,Integer parentId,String text,Integer level){
        super();
        this.id = id;
        this.text = text;
        this.parentId = parentId;
        this.level = level;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public List<Tree<T>> getNodes() {
        if(nodes==null){
            nodes = new ArrayList<Tree<T>>();
        }
        return nodes;
    }

    public void setNodes(List<Tree<T>> nodes) {
        this.nodes = nodes;
    }


}
